package com.example.day2.adapter;

import android.view.View;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.example.day2.R;
import com.example.day2.entity.CommentResult;

import java.util.List;

public class CommentAdapter extends BaseQuickAdapter<CommentResult.DataBean, BaseViewHolder> {
    public CommentAdapter(int layoutResId, @Nullable List<CommentResult.DataBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, CommentResult.DataBean dataBean) {
        ImageView view = baseViewHolder.getView(R.id.iv);
        Glide.with(getContext()).load(dataBean.getIcon()).circleCrop().into(view);
        baseViewHolder.setText(R.id.tv1,dataBean.getTousername());
        baseViewHolder.setText(R.id.tv2,dataBean.getMsg());
        baseViewHolder.setText(R.id.tv3,dataBean.getCreatetime());

    }
}
